﻿@model IEnumerable<QuanLyGiaoVuUI.Models.MonHoc.MonHocViewModel>

@{
    ViewBag.Title = "DanhSachMonHoc";
    Layout = "~/Views/Shared/_blueWhaleLayout.cshtml";
}

@{Html.RenderPartial("LopMonHocMenuPartial");}

<div id="main" class="grid_10">
    <!--  start page-heading -->

    <div id="page-heading" class="box round first grid">
        <h2>Danh sách các môn học</h2>
    <!-- end page-heading -->

    <div class="block">
        
        <table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
                                @if (Model.Count() == 0)
                            {
                                <tr>
                                    <span>Không có dữ liệu!</span>
                                </tr>
                            }
                            else
                            {

                            <tr>
                                <th class="sorting table-header-check"><a id="toggle-all"></a></th>
                                <th class="sorting table-header-repeat line-left minwidth-1"><a href="">Mã môn học</a></th>
                                <th class="sorting table-header-repeat line-left"><a href="">Tên môn học</a></th>
                                <th class="sorting table-header-repeat line-left"><a href="">Tổng số tín chỉ</a></th>
                                <th class="sorting table-header-repeat line-left"><a href="">Số tín chỉ lý thuyết</a></th>
                            </tr>
                                int count = 0;
                                foreach (QuanLyGiaoVuUI.Models.MonHoc.MonHocViewModel viewModel in Model)
                                {
                                <tr class="gradeA @(++count % 2 == 0 ? "even" : "odd") @(viewModel.MaMonChinh == null ?"lopGoc" : "")">
                                    <td>
                                        @if (viewModel.MaMonChinh == null){
                                            <img src="~/Content/themes/bluewhale/img/switch_minus.gif" />
                                        }
                                    </td>
                                    <td>@viewModel.MaMonHoc</td>
                                    <td style="text-align:justify">@viewModel.TenMonHoc</td>
                                    <td>@viewModel.TongSoTinChi</td>
                                    <td>@viewModel.SoTinChiLyThuyet</td>
                                </tr>
                                }
                            }
                        </table>
        <div style="margin-top: 5px">
            <input type="button" id="btnThemMonHoc" name="btnThemMonHoc" value="Thêm môn học mới" />
        </div>
    </div>
</div>
</div>

<div class="clear">&nbsp;</div>

<div id="capNhatMonHocDialog"></div>

<script>
    $(document).ready(function () {
        $("#btnThemMonHoc").button().bind("click", function () {
            $("#capNhatMonHocDialog").load("/MonHoc/CapNhat").dialog({
                title: "Thêm môn học mới",
                width: 600,
                height: 400,
                buttons: {
                    "Thêm": function () {
                        CapNhatMonHoc.SubmitForm();
                    },
                    "Hủy": function () {
                        $("#capNhatMonHocDialog").dialog("close");
                    }
                }
            });
        });
    });
</script>
